<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%--
  Created by IntelliJ IDEA.
  User: 董灌磊
  Date: 2024/4/20
  Time: 8:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/webjars/layui/2.6.8/css/layui.css">
    <script src="/webjars/layui/2.6.8/layui.js"></script>
</head>
<body>
<div class="layui-container">
    <div class="layui-form" id="searchForm" lay-filter="searchForm">
        <div class="layui-inline">
            <label class="layui-form-label">手机号:</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" placeholder="手机号查询" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">车牌号:</label>
            <div class="layui-input-inline">
                <input type="text" name="carno" placeholder="车牌号查询" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <button class="layui-btn" onclick="search()" >查询</button>
        </div>
    </div>
</div>
<table id="trafficTable" lay-filter="trafficTables"  class="layui-table layui-table-hover"></table>
<script>
    var $=layui.$
    layui.use(function (){
        let table=layui.table;
        table.render({
            id:"one",
            elem:"#trafficTable",
            url:"/park/trafficrecords/show",
            toolbar: "#headTool",
            page:true,
            cols:[[
                {field:'number',align: 'center',type:'numbers',title:"编号"},
                {field:'id',align: 'center',hide:true,title:"序号"},
                {field:'ownername',align: 'center',title:"姓名"},
                {field:'ownerphone',align: 'center',title:"手机号"},
                {field:'parklotname',align: 'center',title:"停车位"},
                {field:'parkname',align: 'center',title:"停车场"},
                {field:'starttime',align: 'center',title:"开始时间"},
                {field:'endtime',align: 'center',title:"结束时间"},
                {field:'carno',align: 'center',title:"车牌号"},
            ]]
        })
    })
    //点击去查询
    function search(){
        //获取表单的值,表单序列化
        var where = layui.form.val('searchForm');
        console.log(where)
        //条件查询，重载表格因为键和值都是where，所以可以值保留键
        layui.table.reload('one',{
            page: {
                curr:1
            },
            where:where
        });
    }
</script>
</body>
</html>
